package com.ndp.fb.scheduler.job.statistics;

import com.alibaba.dubbo.config.annotation.Reference;
import com.ndp.fb.constant.ConfigConst;
import com.ndp.fb.mq.api.service.schedulerservice.FetchRetentionFilesScheduleService;
import com.ndp.fb.scheduler.annotation.CronScheduled;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

/**
 * 定时扫描s3存储上的文件
 */
@Component
public class ScanRetentionRateFileJob {
    private static Logger logger = LoggerFactory.getLogger(ScanRetentionRateFileJob.class);

    @Reference
    private FetchRetentionFilesScheduleService fetchRetentionFilesScheduleService;

    /**
     * 定时扫描s3上存储的广告留存率数据文件
     */
    @CronScheduled(cronkey = ConfigConst.SCHEDULE_SCAN_RETENTION_RATE_CRON, enablekey = ConfigConst.SCHEDULE_SCAN_RETENTION_RATE_ENABLE)
    public void fetchRetentionRateFile() {
        logger.info("定时扫描s3系统留存率数据文件，下载到本地后进行分析处理");
        fetchRetentionFilesScheduleService.fetchProcessFiles();
    }
}
